import { CHANGE_TYPE_FUNCTION } from "@/constant/const";

/**
 * 变更余额
 * @param {{}} item
 * @param {String} key
 */
function updateOperation(item, key) {
  this.clickId = parseInt(item.id);
  this.row = item;
  console.log("this.clickId", this.clickId);
  this[key] = true;
}

/**
 * 关闭变更余额弹窗
 * @param {Boolean} value
 * @param {{}} data
 */
function close(value, data, confirm = false) {
  this.visiable = value;
  if (!confirm) return;
  let func = CHANGE_TYPE_FUNCTION[data.changeType];

  if (!func) {
    return;
  }
  func(this.row, data.money);
}

export { close, updateOperation };
